import { ResponseAdminMenuPermissionsType } from '@/services/apis/admin/menu';
import { ResponseBodyType, ResponseDetailType } from '@/services/apis/types';
import { success } from '../common';

const menuTree: ResponseDetailType = {
  code: 0,
  type: 'SUCCESS',
  message: '操作成功',
  data: [
    {
      id: 0,
      name: '顶级菜单',
      parentId: 0,
      describe: '顶级菜单',
      path: '/',
      hideChildrenInMenu: false,
      hideInMenu: false,
      enabled: true,
      level: 0,
      children: [
        {
          id: 1,
          key: 'Admin',
          name: '系统设置',
          parentId: 0,
          describe: '系统设置',
          path: '/admin',
          redirect: '/',
          component: '',
          sort: 0,
          icon: '',
          hideChildrenInMenu: false,
          hideInMenu: false,
          enabled: true,
          createTime: '2022-06-26 22:28:24',
          modifyTime: '2022-06-26 22:28:24',
          level: 1,
          children: [
            {
              id: 2,
              key: 'AdminUser',
              name: '账号管理',
              parentId: 1,
              describe: '账号列表',
              path: '/admin/user',
              redirect: '/',
              component: '',
              sort: 0,
              icon: '',
              hideChildrenInMenu: true,
              hideInMenu: false,
              enabled: false,
              createTime: '2022-08-06 15:09:09',
              modifyTime: '2022-08-11 00:57:19',
              level: 2,
            },
            {
              id: 3,
              key: 'AdminRole',
              name: '角色管理',
              parentId: 1,
              describe: '角色列表',
              path: '/admin/role',
              redirect: '/',
              component: '',
              sort: 0,
              icon: '',
              hideChildrenInMenu: true,
              hideInMenu: false,
              enabled: true,
              createTime: '2022-08-06 15:08:22',
              modifyTime: '2022-08-10 22:45:34',
              level: 2,
            },
            {
              id: 4,
              key: 'AdminMenu',
              name: '菜单管理',
              parentId: 1,
              describe: '菜单列表',
              path: '/admin/menu',
              redirect: '/',
              component: '',
              sort: 0,
              icon: '',
              hideChildrenInMenu: true,
              hideInMenu: false,
              enabled: true,
              createTime: '2022-06-26 22:29:08',
              modifyTime: '2022-08-08 02:41:15',
              level: 2,
              children: [
                {
                  id: 7,
                  key: 'AdminMenuAdd',
                  name: '添加菜单',
                  parentId: 4,
                  describe: '添加菜单',
                  path: '/admin/menu/add',
                  redirect: '/',
                  component: '',
                  sort: 0,
                  icon: '',
                  hideChildrenInMenu: true,
                  hideInMenu: true,
                  enabled: true,
                  createTime: '2022-08-06 15:12:39',
                  modifyTime: '2022-08-11 00:57:29',
                  level: 3,
                },
                {
                  id: 8,
                  key: 'AdminMenuEdit',
                  name: '编辑菜单',
                  parentId: 4,
                  describe: '编辑菜单',
                  path: '/admin/menu/edit',
                  redirect: '/',
                  component: '',
                  sort: 0,
                  icon: '',
                  hideChildrenInMenu: true,
                  hideInMenu: true,
                  enabled: true,
                  createTime: '2022-08-06 15:13:40',
                  modifyTime: '2022-08-11 00:57:33',
                  level: 3,
                },
              ],
            },
            {
              id: 5,
              key: 'AdminPermission',
              name: '权限管理',
              parentId: 1,
              describe: '权限管理',
              path: '/admin/permission',
              redirect: '/',
              component: '',
              sort: 0,
              icon: '',
              hideChildrenInMenu: true,
              hideInMenu: false,
              enabled: true,
              createTime: '2022-08-06 15:10:20',
              modifyTime: '2022-08-11 00:57:49',
              level: 2,
            },
            {
              id: 6,
              key: 'AdminApi',
              name: '接口管理',
              parentId: 1,
              describe: '接口管理',
              path: '/admin/api',
              redirect: '/',
              component: '',
              sort: 0,
              icon: '',
              hideChildrenInMenu: false,
              hideInMenu: false,
              enabled: true,
              createTime: '2022-08-06 15:11:37',
              modifyTime: '2022-08-06 15:11:40',
              level: 2,
            },
          ],
        },
      ],
    },
  ],
};

const menuDetail: ResponseDetailType = {
  code: 0,
  type: 'SUCCESS',
  message: '操作成功',
  data: {
    id: 1,
    key: 'Admin',
    name: '系统设置',
    parentId: 0,
    describe: '系统设置',
    path: '/admin',
    redirect: '/',
    component: '',
    sort: 0,
    icon: '',
    hideChildrenInMenu: false,
    hideInMenu: false,
    enabled: true,
    createTime: '2022-06-26 22:28:24',
    modifyTime: '2022-06-26 22:28:24',
  },
};
const menuPermissionsDetail: ResponseAdminMenuPermissionsType = {
  menu: {
    id: 4,
    name: '菜单管理',
    path: '/admin/menu',
    key: 'AdminMenu',
  },
  permissions: [
    {
      menuId: 4,
      apis: [],
      key: 'AdminMenuView',
      type: 'view',
      typeText: '查看',
      name: '菜单查看',
      describe: '菜单查看',
      enabled: true,
    },
    {
      menuId: 4,
      key: 'AdminMenuEdit',
      apis: [],
      type: 'edit',
      typeText: '编辑',
      name: '菜单编辑',
      describe: '菜单编辑',
      enabled: true,
    },
    {
      menuId: 4,
      apis: [],
      key: 'AdminMenuDelete',
      type: 'delete',
      typeText: '删除',
      name: '菜单删除',
      describe: '菜单删除',
      enabled: true,
    },
  ],
};
const menuPermissions: ResponseDetailType = {
  code: 0,
  message: 'success',
  type: 'SUCCESS',
  data: menuPermissionsDetail,
};

const pageMenus: ResponseBodyType = {
  code: 0,
  type: 'SUCCESS',
  message: '操作成功',
  data: [
    {
      id: 2,
      key: 'AdminUser',
      name: '账号管理',
      parentId: 1,
      describe: '账号列表',
      path: '/admin/user',
      redirect: '/',
      component: '',
      sort: 0,
      icon: '',
      hideChildrenInMenu: true,
      hideInMenu: false,
      enabled: true,
      createTime: '2022-08-06 15:09:09',
      modifyTime: '2022-08-11 00:57:19',
    },
    {
      id: 3,
      key: 'AdminRole',
      name: '角色管理',
      parentId: 1,
      describe: '角色列表',
      path: '/admin/role',
      redirect: '/',
      component: '',
      sort: 0,
      icon: '',
      hideChildrenInMenu: true,
      hideInMenu: false,
      enabled: true,
      createTime: '2022-08-06 15:08:22',
      modifyTime: '2022-08-10 22:45:34',
    },
    {
      id: 4,
      key: 'AdminMenu',
      name: '菜单管理',
      parentId: 1,
      describe: '菜单列表',
      path: '/admin/menu',
      redirect: '/',
      component: '',
      sort: 0,
      icon: '',
      hideChildrenInMenu: true,
      hideInMenu: false,
      enabled: true,
      createTime: '2022-06-26 22:29:08',
      modifyTime: '2022-08-08 02:41:15',
    },
    {
      id: 5,
      key: 'AdminPermission',
      name: '权限管理',
      parentId: 1,
      describe: '权限管理',
      path: '/admin/permission',
      redirect: '/',
      component: '',
      sort: 0,
      icon: '',
      hideChildrenInMenu: true,
      hideInMenu: false,
      enabled: true,
      createTime: '2022-08-06 15:10:20',
      modifyTime: '2022-08-11 00:57:49',
    },
    {
      id: 6,
      key: 'AdminApi',
      name: '接口管理',
      parentId: 1,
      describe: '接口管理',
      path: '/admin/api',
      redirect: '/',
      component: '',
      sort: 0,
      icon: '',
      hideChildrenInMenu: false,
      hideInMenu: false,
      enabled: true,
      createTime: '2022-08-06 15:11:37',
      modifyTime: '2022-08-06 15:11:40',
    },
  ],
};

const modelPageData = {
  code: 0,
  type: 'SUCCESS',
  message: '操作成功',
  data: [
    {
      modelId: 1,
      modelName: '系统设置',
      pages: [
        {
          pageId: 2,
          pageName: '账号管理',
          permissions: [
            {
              permissionId: 3,
              permissionName: '账号删除',
              permission: 'delete',
              permissionText: '删除',
            },
            {
              permissionId: 2,
              permissionName: '账号编辑',
              permission: 'edit',
              permissionText: '编辑',
            },
            {
              permissionId: 1,
              permissionName: '账号查看',
              permission: 'view',
              permissionText: '查看',
            },
          ],
        },
        {
          pageId: 3,
          pageName: '角色管理',
          permissions: [
            {
              permissionId: 6,
              permissionName: '角色删除',
              permission: 'delete',
              permissionText: '删除',
            },
            {
              permissionId: 5,
              permissionName: '角色编辑',
              permission: 'edit',
              permissionText: '编辑',
            },
            {
              permissionId: 4,
              permissionName: '角色查看',
              permission: 'view',
              permissionText: '查看',
            },
          ],
        },
        {
          pageId: 4,
          pageName: '菜单管理',
          permissions: [
            {
              permissionId: 9,
              permissionName: '菜单删除',
              permission: 'delete',
              permissionText: '删除',
            },
            {
              permissionId: 8,
              permissionName: '菜单编辑',
              permission: 'edit',
              permissionText: '编辑',
            },
            {
              permissionId: 7,
              permissionName: '菜单查看',
              permission: 'view',
              permissionText: '查看',
            },
          ],
        },
        {
          pageId: 5,
          pageName: '权限管理',
          permissions: [
            {
              permissionId: 12,
              permissionName: '权限删除',
              permission: 'delete',
              permissionText: '删除',
            },
            {
              permissionId: 11,
              permissionName: '权限编辑',
              permission: 'edit',
              permissionText: '编辑',
            },
            {
              permissionId: 10,
              permissionName: '权限查看',
              permission: 'view',
              permissionText: '查看',
            },
          ],
        },
        {
          pageId: 6,
          pageName: '接口管理',
          permissions: [
            {
              permissionId: 15,
              permissionName: '接口删除',
              permission: 'delete',
              permissionText: '删除',
            },
            {
              permissionId: 14,
              permissionName: '接口编辑',
              permission: 'edit',
              permissionText: '编辑',
            },
            {
              permissionId: 13,
              permissionName: '接口查看',
              permission: 'view',
              permissionText: '查看',
            },
          ],
        },
      ],
    },
  ],
};
export default {
  'POST /api/admin/menu/tree': menuTree,
  'POST /api/admin/menu/add': success,
  'POST /api/admin/menu/edit': success,
  'POST /api/admin/menu/enable': success,
  'POST /api/admin/menu/delete': success,
  'POST /api/admin/menu/detail': menuDetail,
  'POST /api/admin/menu/permissions': menuPermissions,
  'POST /api/admin/menu/pages': pageMenus,
  'POST /api/admin/menu/mode': modelPageData,
};
